#pragma once
#include "GLDrawable.h"
#include "common.h"
struct GLBillBoardPrivate;
class GLBillBoard : public GLDrawable
{
	using Super = GLDrawable;

public:
	GLBillBoard();
	~GLBillBoard();

	void setGeometryChangedCallback(const Callback& call);
	void setIsSelectedChangedCallback(const Callback& call);
	void setIsExpandChangedCallback(const Callback& call);

public:
	bool onPress(const QPoint& pos);
	bool onMove(const QPoint& pos);
	bool onRelease(const QPoint& pos);
	bool onDoubleClicked(const QPoint& pos);

public:
	void		  setPos(const QPoint& pos, bool notify = true);
	const QPoint& pos() const;
	void		  setSize(const QSize& size, bool notify = true);
	const QSize&  size() const;

	void setIsSelected(bool v, bool notify = true);
	bool isSelected() const;

	void setIsExpand(bool v, bool notify = true);
	bool isExpand() const;

	QRect windowRect() const;

	QVector<QVector3D> getVertices() const;

	// 组件整体变换用的矩阵
	const QMatrix4x4& compMat() const;
	void			  setCompMat(const QMatrix4x4& mat);

private:
	bool containsPos(const QPoint& windowPos) const;
	void updateWindowPos();

private:
	GLBillBoardPrivate* d;
};
